<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>搜索商品</title>
		<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">

		<!--标准mui.css-->
		<link rel="stylesheet" href="../css/mui.min.css">
		<!--App自定义的css-->
		<link rel="stylesheet" type="text/css" href="../css/app.css" />
		<link rel="stylesheet" type="text/css" href="../css/index.css" />
<script src="../js/jquery.min.js" type="text/javascript" charset="utf-8"></script>
		<script src="../js/mui.min.js"></script>
		<style>
			.historyText{
				background: #FFFFFF;border-radius:5px;background-color:#EFEFF4;padding: 0.3rem;margin: 0.3rem;
				display: inline-block; 
			}
			body{
				background-color: #FFFFFF;
			}
		</style>
	</head>
	<body>
		<header class="mui-bar mui-table-view" style="box-shadow:none; border: none; position: fixed; top:0;">
			<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
			<h1 class="mui-title">搜索</h1>
			<a  class="mui-icon  mui-icon-more-filled mui-pull-right"></a>
		</header>
		<div class="search-sou">
            <div class="mui-input-row mui-search search-nei">
                <input type="search" id="bookName" onsearch="onSearch()"  oninput="OnInput (event)"  placeholder="搜索你最爱的图书" style="background: #E8E8E8;width:100%; padding-top:.5rem; text-align:center;padding-left:-1rem;">
            </div>
            <div id="headerControl">
               <button style="float:right; padding-top:.5rem; font-size:14px; background-color:transparent;" >取消</button>
            </div>
        </div>	
       
            <div style="width: 100%;background: #FFFFFF;margin-top:6.1rem;position: relative;" id="searchResult">
        	<ul  class="mui-table-view">
        		<li class="mui-table-view-cell">
        			<a onclick="seeDeatil()">郑爽的书</a>
        		</li>
        		<li class="mui-table-view-cell">
        			<a onclick="seeDeatil()">郑爽的书</a>
        		</li>
        		<li class="mui-table-view-cell">
        			<a onclick="seeDeatil()">郑爽的书</a>
        		</li>
        		<li class="mui-table-view-cell">
        			<a onclick="seeDeatil()">郑爽的书</a>
        		</li>
        		<li class="mui-table-view-cell">
        			<a onclick="seeDeatil()">郑爽的书</a>
        		</li>
        		<li class="mui-table-view-cell">
        			<a onclick="seeDeatil()">郑爽的书</a>
        		</li>
        		
        	</ul>
        	
        </div>
       <div style="width: 100%;background: #FFFFFF;margin-top:6.1rem;position: relative;" id="history">
        	<div style="padding: 0 0.5rem;margin-top: 2rem;">
        		<span>历史搜索</span> 
        	    <div style="float: right;" >
        			<a class="mui-tab-item" href="#delete"  >
					<font color="#CF2D28">清除</font>
			        </a>
			    </div>
        	</div>
        	
			<div style="margin:0.7rem 0.5rem 0.5rem 0.5rem;"> 
				<a onclick="seeDeatil()"><span class="historyText">郑爽的书</span></a>
				<a onclick="seeDeatil()"><span class="historyText">郑爽的书</span></a>
				<a onclick="seeDeatil()"><span class="historyText">郑爽的书</span></a>
				<a onclick="seeDeatil()"><span class="historyText">郑爽的书</span></a>

			</div>
        </div>
    
        
        <div style="width: 100%; background: #FFFFFF; margin-top: 6.1rem;" id="detail">
        	<div class="search-kuai" onclick="window.location.href='borrow1.html';">
        		<img class="search-img" src="../images/book2.jpg">
        		<div class="search-p">幸福就是可以一起睡觉</div>
        		<div style="clear: both;"></div>
        	</div>
        	<div class="search-kuai" onclick="window.location.href='borrow1.html';">
        		<img class="search-img" src="../images/book2.jpg">
        		<div class="search-p">幸福就是可以一起睡觉</div>
        		<div style="clear: both;"></div>
        	</div>
        	<div class="search-kuai" onclick="window.location.href='borrow1.html';">
        		<img class="search-img" src="../images/book2.jpg">
        		<div class="search-p">幸福就是可以一起睡觉</div>
        		<div style="clear: both;"></div>
        	</div>
        	<div class="search-kuai" onclick="window.location.href='borrow1.html';">
        		<img class="search-img" src="../images/book2.jpg">
        		<div class="search-p">幸福就是可以一起睡觉</div>
        		<div style="clear: both;"></div>
        	</div>
        	<div class="search-kuai" onclick="window.location.href='borrow1.html';">
        		<img class="search-img" src="../images/book2.jpg">
        		<div class="search-p">幸福就是可以一起睡觉</div>
        		<div style="clear: both;"></div>
        	</div>      	
        </div>
 <script>
		 	
		 	
		 	$(document).ready(function(){
                  $('#detail').hide();
                  $('#searchResult').hide();
});
            
       function OnInput (event) {
          var value=event.target.value;
          if(value!=null && value.length!=0)
          {
          	$('#history').hide();
      
          /*	$('#headerControl').html('<button style:"border-ridus:5px;background-color:#CF2D28;">搜索</button>');*/
          	$('#searchResult').show();
          	 $('#detail').hide();
          }else{
          	$('#history').show();
          	 $('#searchResult').hide();
          	 $('#detail').hide();
          }
        }
           function onSearch () {
           	var value = $('#bookName').val();
          if(value!=null && value.length!=0)
          {
          	$('#history').hide();
      
          	$('#headerControl').html('<button style="float:right; padding-top:.5rem; font-size:14px; background-color:#CF2D28;color:#FFFFFF;" onclick="search()">搜索</button>');
          	$('#searchResult').hide();
          	 $('#detail').show();
          }else{
          	$('#history').show();
          	 $('#searchResult').hide();
          	 $('#detail').hide();
          }
        
        }
       function seeDeatil()
       {
       	   $('#searchResult').hide();
       	   $('#history').hide();

           $('#headerControl').html('<button style="float:right; padding-top:.5rem; font-size:14px; background-color:#CF2D28;color:#FFFFFF;"  onclick="search()">搜索</button>');
           $('#detail').show();
       }
       function search()
       {
       	   var value = $('#bookName').val();
          if(value!=null && value.length!=0)
          {
          	$('#history').hide();
      
          	$('#headerControl').html('<button style="float:right; padding-top:.5rem; font-size:14px; background-color:#CF2D28;color:#FFFFFF;" onclick="search()">搜索</button>');
          	$('#searchResult').hide();
          	 $('#detail').show();
          }else{
          	$('#history').show();
          	 $('#searchResult').hide();
          	 $('#detail').hide();
          }
       }
		 </script>		 
	</body>
</html>
